var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, o) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var o in t)
              Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
          })(t, o);
      };
      return function (t, o) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        e(t, o),
          (t.prototype =
            null === o
              ? Object.create(o)
              : ((a.prototype = o.prototype), new a()));
      };
    })(),
  CombatResultDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        t.bt_ok.on(Laya.Event.CLICK, t, t.btnOkFn),
        t.btn_comeback.on(Laya.Event.CLICK, t, t.btnComeBackDidClick),
        WebSocketService.addListener({
          caller: t,
          code: 1059,
          method: t.onEveryOneCureDataFn,
        }),
        WebSocketService.addListener(
          { caller: t, code: 1241, method: t.onEveryOneCureDataFn },
          !0
        ),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showCombatResultView = function (e, o) {
        null == this.resultV &&
          ((this.resultV = new t()), (this.resultV.zOrder = 1e3)),
          "success" == e
            ? ((this.resultV.label_resultTitle.text = "战斗胜利"),
              (this.resultV.label_resultTitle.color = "#ff3200"),
              (this.resultV.label_resultTitle.strokeColor = "#3ef604"))
            : "faile" == e &&
              ((this.resultV.label_resultTitle.color = "#6c6564"),
              (this.resultV.label_resultTitle.strokeColor = "#343833"),
              (this.resultV.label_resultTitle.text = "战斗失败"),
              Laya.stage.event("HomePageView", {
                code: "setAutoFight",
                isAuto: !1,
              }),
              Laya.stage.event("GameMainView", {
                code: "setAutoFight",
                isAuto: !1,
              }),
              Laya.stage.event("GameMainView", "npc"),
              localStorage.setItem("startAuto", ""),
              WebSocketService.send({ c: 100 })),
          (this.resultV.label_resultContent.text = o),
          this.resultV.popup(!0),
          AutoStopView.hide();
        var a = localStorage.getItem("startAuto");
        if (a && -1 != a.indexOf(":")) {
          var i = a.split(":"),
            s = i[0],
            n = i[1];
          if (s.length > 0) {
            var r = localStorage.getItem("autofightTime");
            0 == Global.vipBag &&
              ("0" == n
                ? WebSocketService.send({ c: 1059 })
                : WebSocketService.send({ c: 1241, d: { qr: 9 } })),
              "faile" == e &&
                WebSocketService.send({
                  c: 1437,
                  d: { siteId: Global.roleCityId },
                }),
              setTimeout(function () {
                if (parseInt(r) <= 0)
                  return (
                    Laya.stage.event("HomePageView", {
                      code: "setAutoFight",
                      isAuto: !1,
                    }),
                    Laya.stage.event("GameMainView", {
                      code: "setAutoFight",
                      isAuto: !1,
                    }),
                    localStorage.setItem("startAuto", ""),
                    !1
                  );
                WebSocketService.send({ c: 500, d: { npcId: s } }),
                  Laya.stage.event("HomePageView", {
                    code: "setAutoFight",
                    isAuto: !0,
                  }),
                  Laya.stage.event("GameMainView", {
                    code: "setAutoFight",
                    isAuto: !0,
                  });
              }, 5e3);
          }
        }
        return this.resultV;
      }),
      (t.prototype.btnOkFn = function () {
        this.close("OK");
      }),
      (t.prototype.btnComeBackDidClick = function () {
        WebSocketService.send({ c: 1059 }), this.close("OK");
      }),
      (t.prototype.onEveryOneCureDataFn = function (e) {
        this &&
          1 == this.visible &&
          ("1059" == e.act_id
            ? (0 == e.code &&
                (Laya.stage.event("HomePageView", "exp"),
                Laya.stage.event("GameMainView", "exp")),
              ToastView.toastView(e.msg))
            : "1241" == e.act_id &&
              (0 == e.code &&
                (Laya.stage.event("HomePageView", "exp"),
                Laya.stage.event("GameMainView", "exp")),
              ToastView.toastView(e.msg)));
      }),
      t
    );
  })(ui.common.CombatResultDialogUI);
